package com.example.config;

import com.example.interceptor.DemoInterceptor;
import com.example.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration // 配置类
public class WebConfig implements WebMvcConfigurer {
//    @Autowired
//    private DemoInterceptor demoInterceptor;

    @Autowired
    private TokenInterceptor tokenInterceptor;

    // 拦截器注册
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(demoInterceptor) // 注册示例拦截器
//                .addPathPatterns("/**");// 拦截所有请求


//        registry.addInterceptor(tokenInterceptor) // 注册拦截器
//                .addPathPatterns("/**");// 拦截所有请求
    }
}
